package de.sp.games.snake12k;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import java.io.File;

import org.lwjgl.*;

public class Snake12k extends StateBasedGame {

	public static final String version = "1.1";

	public static final int GAMEPLAYSTATE = 1;
	public static final int GAMEOVERSTATE = 2;
	public static final int TITLEMENUSTATE = 3;
	public static final int OPTIONSSTATE = 4;
	public static final int HIGHSCORESTATE = 5;

	public Snake12k() {
		super("Snake12k");
	}

	public static void main(String[] args) throws SlickException {
		//System.setProperty("org.lwjgl.librarypath", new File(new File(System.getProperty("user.dir"), "native"), LWJGLUtil.getPlatformName()).getAbsolutePath());
		//System.setProperty("net.java.games.input.librarypath", System.getProperty("org.lwjgl.librarypath"));
		
		AppGameContainer app = new AppGameContainer(new Snake12k());
		app.setIcons(new String[] { "ressource/fav32.png", "ressource/fav24.png", "ressource/fav16.png" });

		app.setShowFPS(false);
		app.setVSync(true);
		app.setDisplayMode(600, 630, false); // 30
		app.setMaximumLogicUpdateInterval(30);
		app.setMinimumLogicUpdateInterval(20);
		app.setTargetFrameRate(60);
		app.setAlwaysRender(false);
		app.start();
	}

	public void initStatesList(GameContainer gameContainer) throws SlickException {
		this.addState(new TitleMenuState(TITLEMENUSTATE));
		this.addState(new GameplayState(GAMEPLAYSTATE));
		this.addState(new GameOverState(GAMEOVERSTATE));
		this.addState(new OptionsState(OPTIONSSTATE));
		this.addState(new HighscoreSate(HIGHSCORESTATE));

		this.enterState(TITLEMENUSTATE);
	}
}
